﻿using System;
using System.Web.Security;
using NotWindowsStore.Helpers;

namespace NotWindowsStore.Models
{
    public partial class NwsUser
    {
        public bool CheckPassword(string password)
        {
            return Md5Helpers.ComputeHashAsHexString(password) == Password;
        }

        public void SetPassword(string password)
        {
            Password = Md5Helpers.ComputeHashAsHexString(password);
        }

        public MembershipUser ToMembershipUser()
        {
            return new MembershipUser("NotWindowsStoreMembershipProvider", UserName, UserId, UserName, null, null, true, !Active,
                new DateTime(2010, 10, 10), // TODO change creation date
                DateTime.Now, DateTime.Now, DateTime.Now, DateTime.MinValue);
        }
    }
}